package com.dong.curator.checkConfig;

import org.apache.curator.RetryPolicy;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.retry.RetryNTimes;

import java.util.concurrent.CountDownLatch;

/**
 * @author: dzj
 * @date 2018/10/11-13:06
 */
public class BaseClient {
    public CuratorFramework client = null;
    public static final String zkServerPaht = "";

    public BaseClient() {
        RetryPolicy rp = new RetryNTimes(3,5000);
        client=CuratorFrameworkFactory
                .builder()
                .retryPolicy(rp)
                .connectString(zkServerPaht)
                .sessionTimeoutMs(15000)
                .namespace("workspace")
                .build();
        client.start();
    }
    public void closeZkClient() {
        if(client!=null) {
            client.close();
        }
    }
    public static final String CONFIG_NODE_PATH="/super/imooc";
    public static final String SUB_PATH="/redis/config";
    public static CountDownLatch cdl = new CountDownLatch(1);

    public static void main(String[] args) {
        BaseClient cto = new BaseClient();
        System.out.println();
    }
}
